Page({
  data: {
    statusList: ['全部', '待处理', '已发货'],
    currentStatus: 0,
    orderList: []
  },
  onLoad() {
    // 初始化页面数据
    this.getOrders()
  },
  getOrders() {
    // 获取经销商订单，使用模拟数据
    try {
      // 模拟订单数据
      const mockOrders = [
        { id: 1, orderNo: 'SF2025001', customer: '客户A', amount: 299.00, status: '待处理' },
        { id: 2, orderNo: 'SF2025002', customer: '客户B', amount: 158.00, status: '已发货' }
      ]
      
      setTimeout(() => {
        this.setData({orderList: mockOrders})
      }, 500)
    } catch (error) {
      console.error('获取订单失败:', error)
      this.setData({orderList: []})
    }
  },
  filterStatus(e) {
    this.setData({currentStatus: e.detail.value})
    this.getOrders()
  },
  processOrder(e) {
    const id = e.currentTarget.dataset.id
    // 处理订单逻辑
  }
})